import React, { useEffect, useState } from 'react';
import { Modal, Form, Space } from 'antd';
import FormCondition from '@/components/FormCondition';
import { connect, history } from 'umi';
import { Button, Row, Col } from 'antd';
const CheckOrderForm = (props) => {
  const { visible = false, onClose, loading, dispatch, handleCallback, cleanSelect } = props;
  const { show = false, detail = {}, selectIdList } = visible;
  const { orderSn, } = detail;
  const [status, setStatus] = useState(null)
  const [form] = Form.useForm();
  // 确认提交
  const handleUpAudit = () => {
    form.validateFields().then((values) => {
      dispatch({
        type: 'promoter/fakeCheckWithdraw', payload: {
          ...values, idList: selectIdList
        }, callback: () => {
          onClose()
          handleCallback()
          cleanSelect()
        }
      })

    });
  };
  const formItems = [
    {
      label: `审核状态`,
      name: 'status',
      type: 'select',
    select:{
      1:"审核通过",
      2:'审核拒绝'
    }
    },

    {
      label: `备注`,
      name: 'checkRemark',
      type: 'textArea',
      rules: [{ required: false }],
    },

  ];

  const modalProps = {
    title: '确认作废',
    width: 1200,
    visible: show,
    maskClosable: true,
    destroyOnClose: true,
    zIndex: 1001,
    confirmLoading: loading,
  };

  return (
    <Modal {...modalProps} onCancel={onClose} onOk={handleUpAudit}>
      <Space direction={'vertical'} style={{ display: 'flex', textAlign: 'center', justifyContent: 'center', width: '100%' }}>
        <FormCondition form={form} formItems={formItems}></FormCondition>
      </Space>

    </Modal >
  );
};

export default connect(({ order, loading }) => ({
  loading: loading.effects['order/fakeCheckWithdraw'],
}))(CheckOrderForm);
;
